<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
	<title><?
	if ($out['data_from_model']['title'] != "") echo $out['data_from_model']['title']." - ".$this->config_model->get('all_title'); else {
	if ($out['page']['page_pagetitle'] != "") echo $out['page']['page_pagetitle'].($this->uri->segment(1) != ""?" - ".$this->config_model->get('all_title'):"");
	elseif ($out['page']['page_title'] != "") echo $out['page']['page_title']." - ".$this->config_model->get('all_title');
	elseif (sizeof($out) <= 0) echo ($crumps?str_replace("Главная &raquo; ", "", strip_tags($crumps))."; ":"").$this->config_model->get('all_title');
	}
	?></title>
<?
$desc = ($out['page']['page_description']?$out['page']['page_description']:$this->config_model->get('meta_desc'));
if ($out['data_from_model']['desc']) $desc = $out['data_from_model']['desc'];
$keys = ($out['page']['page_keywords']?$out['page']['page_keywords']:$this->config_model->get('meta_key'));
if ($out['data_from_model']['keys']) $keys = $out['data_from_model']['keys'];
$meta = array(
        array('name' => 'robots', 'content' => 'index, follow'),
        array('name' => 'description', 'content' => $desc),
        array('name' => 'keywords', 'content' => $keys),
        array('name' => 'Content-type', 'content' => 'text/html; charset=utf-8', 'type' => 'equiv')
    );

echo meta($meta);
?>
	<link rel="stylesheet" href="/data/css/prettyPhoto.css?rand=5" type="text/css" media="screen" />
	<link rel="stylesheet" href="/data/css/cssf-base.css?rand=5" type="text/css" media="screen" />
	<link rel="stylesheet" href="/data/css/jquickform.css?rand=5" type="text/css" media="screen" />
	<link rel="stylesheet" href="/data/css/uploadify.css?rand=5" type="text/css" media="screen" />
	<link rel="stylesheet" href="/data/css/uniform.default.css?rand=5" type="text/css" media="screen" />
	<!--[if lte IE 6]><link rel="stylesheet" href="/data/css/cssf-ie6.css?rand=5" type="text/css" media="screen" /><![endif]-->
	<!--[if IE 7]><link rel="stylesheet" href="/data/css/cssf-ie7.css?rand=5" type="text/css" media="screen" /><![endif]-->
	<link rel="stylesheet" href="/data/css/jstyling.css?rand=5" type="text/css" media="screen" />
	<link rel="stylesheet" href="/data/css/layout.css?rand=5" type="text/css" media="screen" />

<!--	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js?rand=5"></script>
	<script type="text/javascript" src="http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js?rand=5"></script>-->
	<script type="text/javascript" src="/data/js/jquery.min.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/jquery.tools.min.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/jquery-ui-1.8.13.custom.min.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/jquery.maskedinput-1.3.min.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/jquery.prettyPhoto.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/swfobject.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/jquery.uploadify.v2.1.4.min.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/jquery.uniform.min.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/quickpager.jquery.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/cufon-yui.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/Gabriola_400.font.js?rand=5"></script>

		<script type="text/javascript">
			Cufon.replace('.slogan');
		</script>

	<script type="text/javascript" src="/data/js/jquery.jstyling.min.js?rand=5"></script>
	<script type="text/javascript" src="/data/js/js.js?rand=5"></script>
	<link rel="icon" href="/favicon.ico" type="image/x-icon">
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
	<?=read_file('./google.txt')?>
</head>
<body>
	<div class="layout">
<!--		<div class="auth">
			<?=$this->ion_auth_model->show_block()?>
		</div>-->
        <div class="header">
			<div class="phone">
				<?=$this->config_model->get('address')?><br />
				<?=$this->config_model->get('phone_number')?><br />
				<?=$this->config_model->get('icq_number')?><br />
			</div> <!--//phone-->
            <div class="logo">
                <a href='/'><img src='/data/i/logo.png' alt='' title='' /></a>
            </div> <!--//logo-->
            <div class="slogan">
                Снаряжение для приключений
            </div> <!--//slogan-->
			<br class="cc" />
		</div> <!--//header-->
		<div class="banners <?=($this->uri->segment(1) != ""?"hidden":"")?>">
			<div class='one-banner' style="background: url('/uploads/main_slider/1/slide.png') no-repeat center top;">
				<img src="/data/images/x.gif" alt="" title="" />
			</div>
		</div>
                <div class="lwrap">
	<div class="menu_placeholder <?=($this->uri->segment(1) != ""?"variant_inner_page":"")?>">
		<div class="menu">
			<?
				$menu_out = $this->content_model->get_menu_from(2,2);
				echo "<ul class='top-menu'>";
				foreach ($menu_out as $level) {
					if ($level['page_active'] != "") $active = explode(",", $level['page_active']);
					$class = "";
					$class = ($level['page_curl']==$this->uri->segment(1) || ($this->uri->segment(1) == "" && $level['page_curl'] == "homepage") || $out['page']['page_parent'] == $level['page_id'] || (sizeof($active) > 0 && in_array($path, $active))?"active":"");
					echo "<li class='".$class."'>";
						echo "<a href='/".$level['page_curl']."/'>";
							echo ($level['page_desc']?$level['page_desc']:$level['page_title']);
                                                echo "</a>";
												$nohide = false;
                                                if(count($level['childs']) > 0){
                                                    if($class != "active"){
                                                        $display = 'style="display: none;"';
                                                    } else {
                                                        $display = 'style="display: block;"';
                                                        $nohide = $check = true;
                                                    }
													echo "<div class='left-fix-sub toggle_class ".($nohide?"nohide":"")."' ".$display."><img src='/data/images/x.gif' alt='' title='' /></div>";
													echo "<div class='right-fix-sub toggle_class ".($nohide?"nohide":"")."' ".$display."><img src='/data/images/x.gif' alt='' title='' /></div>";
                                                    echo '<ul class="sub toggle_class '.($nohide?"nohide":"").'" '.$display.'>';
                                                    foreach($level['childs'] as $ch){
                                                            $class = '';
                                                            $class = ($ch['page_curl']==$this->uri->segment(1) ||  (sizeof($active) > 0 && in_array($path, $active))?"active":"");
                                                            echo '<li>';
                                                                echo '<a href="/'.$ch['page_curl'].'/" class="'.$class.'">';
                                                                    echo '&#9679;&nbsp;';
                                                                    echo $ch['page_title'];
                                                                echo '</a>';
                                                            echo '</li>';
                                                    }
                                                    echo '</ul>';
                                                }
					echo "</li>";
				}
				echo "</ul>";
			?>
			<br class='cc' />
		</div> <!--//menu-->
		<div class="menu_under">
			<ul class='top-under-menu'>
				<li><a href="#">Тарам пам пам</a></li>
				<li><a href="#">Тарам пам фыв</a></li>
				<li><a href="#">Тарам йцуфыв</a></li>
				<li><a href="#">Тарам йцуфыв</a></li>

			</ul>
		</div> //menu_under
	</div> <!--//menu_placeholder-->

	<?
	$onecol = "";
	if ($this->uri->segment(2) == 'compare') $onecol = "onecol";
	if ($out['page']['page_model'] == 'catalog' && $out['page']['get_function'] == 'show') $onecol = "onecol";
	if ($out['page']['page_model'] == 'catalog' && $out['data_from_model']['onecol'] == true) $onecol = "onecol";
	?>
		<div class="cols">
			<div class="wrap br-10">
				<div class="center-col <?=$onecol?>" >
					<div class="c-c-wrap">
						<div class="crumps">
							<? if ($crumps){
								echo str_replace("&raquo;", " > ", $crumps);
							} elseif($this->uri->segment(1) == 'basket'){
								echo "<a href='/'>Главная</a>";
								echo " > ";
								echo "<a href='/basket/'>Корзина</a>";
							}
							?>
						</div> <!--//crumps-->
						<? if ($onecol && $out['page']['get_function'] != 'show') { echo $this->basket_model->small_basket_block(); } elseif ($onecol) { echo $this->basket_model->check_compare(); }  ?>
						<br class="cc" />
						<div class="content">
							<?=$content_for_layout?>
						</div> <!--//content-->
					</div> <!--//wrap-->
				</div> <!--//center-col-->
				<? if(!$onecol) {?>
				<div class="right-col">
					<div class="r-c-wrap">
						<? if (!$onecol) {?>
						<div class="search">
							<form method="post" action="/catalog/search/">
								<input type='text' name='text' value="<?=($this->input->post('text')?$this->input->post('text'):"")?>" />
								<input type="submit" value="Найти" />
								</form>
						</div>
						<?
						$a = $this->basket_model->get_basket_list(true);
						echo '<div class="basket '.($a['count'] > 0?"":"hidden").'">';
							echo $this->basket_model->show_block();
						echo '</div>';
						?>
						<img title="Термобольё" alt="Термобольё" src="/data/i/termo.png"/>
								<?
								$out = $this->news_model->news_bullet();
								if (count($out) > 0) {
									echo '<div class="bullet">';
									echo '<h2>Новости';
									echo '<div class="line"></div><br class="cc" />';
									echo '</h2>';
									foreach ($out as $el) {
										echo '<div class="one">';
										echo '<small>' . showmedate($el['news_date']) . '</small>';
										echo '<a href="/news/' . $el['news_id'] . '"><p>' . $el['news_title'] . '</p></a>';
										echo '</div>';
									}
									echo '</div>';
								}
								$out = $this->news_model->actions_bullet();
								if (count($out) > 0) {
									echo '<div class="bullet">';
									echo '<h2>Акции';
									echo '<div class="line"></div><br class="cc" />';
									echo '</h2>';
									foreach ($out as $el) {
										echo '<div class="one">';
										echo '<small>' . showmedate($el['news_date']) . '</small>';
										echo '<a href="/actions/' . $el['news_id'] . '"><p>' . $el['news_title'] . '</p></a>';
										echo '</div>';
									}
									echo '</div>';
								}
								$out = $this->news_model->discount_bullet();
								if (count($out) > 0) {
									echo '<div class="bullet">';
									echo '<h2>Скидки';
									echo '<div class="line"></div><br class="cc" />';
									echo '</h2>';
									foreach ($out as $el) {
										echo '<div class="one">';
										echo '<small>' . showmedate($el['news_date']) . '</small>';
										echo '<a href="/discount/' . $el['news_id'] . '"><p>' . $el['news_title'] . '</p></a>';
										echo '</div>';
									}
									echo '</div>';
								}
								?>
								<a href="/news/" title="Все новости">Все новости</a>
								<img alt="Велосипеды" title="Велосипеды" src="/data/i/cycle.png" />
								<?
								$pg_main = $this->db->select()->from('pg')->where('pg_main',1)->where('pg_parent',3)->where('pg_status',1)->limit(1)->get()->row_array();
								if(sizeof($pg_main)> 0){
									echo "<div class='bullet'>";
									echo "<h2>Видео";
									echo "<div class='line'></div><br class='cc' />";
									echo "</h2>";
									echo "<div>".parse_youtube_url($pg_main['pg_video'],"embed",260,190)."</div>";
									echo "</div>";
								}
								echo '<div class="right-feedback">';
								echo '<h2>У вас возник вопрос?</h2>';
								echo '<p>Задайте его нашим операторам</p>';
								echo '<a href="/feedback/" title="Обратная связь">Обратная связь</a>';
								echo '</div>';
							} ?>
					</div> <!-- wrap -->
				</div> <!-- // right-col -->
				<? } ?>
				<br class="cc" />
			</div> <!--//wrap-->
			<br class="cc" />
			<?
			if (sizeof($together) > 0) {
				$data['items'] = $together;
				foreach($data['items'] as $key=>$item){
					$image= $this->db->select()->from('catalog_images')->where('photo_item',$item['item_id'])->where('photo_main',1)->limit(1)->get()->row_array();
					if(count($image) <= 0){
						$image= $this->db->select()->from('catalog_images')->where('photo_item',$item['item_id'])->limit(1)->get()->row_array();
					}
					$data['items'][$key]['image'] = $image;
				}
				$slider = $this->load->view('modules/slider/index', $data, true);
				if(mb_strlen($slider) > 0){
					echo '<h2 class="slider_h2">С этим товаром покупают</h2>';
					echo '<div class="big_center_slider">';
					echo $slider;
					echo '</div>';
				}
				echo "<br class='cc'/>";
			}
			?>
		</div> <!--//cols-->
                </div><!--//wrap-->
	</div> <!--//layout-->
	<div class="footer">
		<div class="wrap">
			<div class='btm-menu'>
			<? $menu_out = $this->content_model->get_menu_from(2, 2);
				echo "<ul class='bottom-menu'>";
				foreach ($menu_out as $level) {
					echo "<li>";
					//if ($level['page_active'] != "") $active = explode(",", $level['page_active']);
					//$class = "";
					//$class = ($level['page_curl']==$this->uri->segment(1) || ($this->uri->segment(1) == "" && $level['page_curl'] == "homepage") || $out['page']['page_parent'] == $level['page_id'] || (sizeof($active) > 0 && in_array($this->uri->segment(1), $active))?"active":"");
						echo "<a href='/".$level['page_curl']."' class='".$class."'>";
							echo ($level['page_desc']?$level['page_desc']:$level['page_title']);
                        echo "</a>";
					echo "</li>";
				}
				echo "</ul>";
			?>
				<br class="cc" />
			</div>
			<div class="w-30 fl a-left"><br />&copy; Copyright. 2010 "<?=$this->config->item('company_name')?>". Все права защищены.</div>
                        <div class="w-35 fl a-center"><br /><a href="/map/">Карта сайта</a></div>
			<? /*<div style='width: 49%;' class="fr a-right"><br /><?=$this->js_link_model->get_text()?></div>*/ ?>
                        <!--js_link вернуть когда будем переносить на сервер, сейчас он убивает все что выводится после него-->
			<div class="w-30 fr a-right"><br /><p>разработка и поддержка  сайта  в  Кургане ООО ЯгуарСофт.</p></div>
			<br class="cc" />
		</div>
	</div>
	<?=$js?>
	<div class="simple_overlay" id="over_msg">
		<div class="close"></div>
		<?
			if ($this->session->flashdata('msg') != "") {
				echo $this->session->flashdata('msg');
				?>
					<script type="text/javascript">
						jQuery(document).ready(function($){
							$("#over_msg").overlay().load();
						});
					</script>
				<?
			}
			if ($msg != "") {
				echo $msg;
				?>
					<script type="text/javascript">
						jQuery(document).ready(function($){
							$("#over_msg").overlay().load();
						});
					</script>
				<?
			}
		?>
	</div> <!-- //simple-overlay over_msg -->
	<div class="simple_overlay" id="over_ajax"><div class="close"></div></div>
	<div class="ajax_work"><img src="/data/images/ajax.gif" alt="Я думаю!" title="Я думаю!" /></div>
	<div class="ajax_notice br-10"></div>
	<script type="text/javascript"> Cufon.now(); </script>
</body>
</html>